package com.woniu.supermarket.mapper;

import com.woniu.supermarket.entity.Role;
import com.woniu.supermarket.vo.RoleVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface RoleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Role record);

    Role selectByPrimaryKey(Integer id);

    List<Role> selectAll();

    int updateByPrimaryKey(Role record);
    //根据员工Id查询角色
    List<Role> selectRolesByEmpId(Integer id);
    //解除员工与角色的绑定
    @Delete("delete from t_emplyee_role where role_id = #{id}")
    void deleteEmployeeRoleById(Integer id);

    List<RoleVo> selectByPage(String roleName);

    List<Long> selectPerIdsByRoleKey(Long id);

    int deleteFromRPByRoleId(Long id);

    int insertBatchRoleAndPer(@Param("rid")Long id,@Param("perIds") List<Long> checkedIds);
}